package org.lanqiao.tjut.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.lanqiao.tjut.bean.UsersBean;
import org.lanqiao.tjut.bean.UsersBeanTea;
import org.lanqiao.tjut.myUtils.MyUtils;
import org.lanqiao.tjut.service.ServiceFactory;

public class UserTeacherDelete extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// 准备用户进行修改的数据
		UsersBeanTea usersBT = new UsersBeanTea();

		usersBT.setTeanum(request.getParameter("userNum"));
		// 删除
		int userId = MyUtils.obj2Int(request.getParameter("uid"));
		// 数据库删除
		ServiceFactory.getUserInfoManagerTeaServiceInstance().deleteTeaCou(userId);
	
		
		List<UsersBeanTea> UsersBT = ServiceFactory.getUserInfoManagerTeaServiceInstance().getAllUsersInfo(usersBT);

		request.getSession().setAttribute("lstUsersTea", UsersBT);

		request.removeAttribute("usersB");

		request.getRequestDispatcher("logined/UserInfoManager/userTeacher.jsp").forward(request, response);
	}
}
